package com.dht.xiao.jianye.dayin.util;

import android.content.Context;
import android.content.SharedPreferences;

/**
 * 保存wifi配置的SharePreference工具
 * 
 * @author zhrjian
 *
 */
	public class WifiSharePreference {
		private static final String WIFI_CONFIG = "wifi_config";
		private static final String WIFI_IP = "wifi_IP";
		private static final String WIFI_PORT = "wifi_port";
		private Context context = null;
		private SharedPreferences sharedPreferences = null;
		private SharedPreferences.Editor editor = null;

		public WifiSharePreference(Context context) {
			this.context = context;
			sharedPreferences = context.getSharedPreferences("WIFI_CONFIG", Context.MODE_PRIVATE);
			editor = sharedPreferences.edit();
		}

		public String getIP() {
			return sharedPreferences.getString(WIFI_IP, "");
		}

		public void setIP(String ip) {
			editor.putString(WIFI_IP, ip);
			editor.commit();
		}

		public String getPort() {
			return sharedPreferences.getString(WIFI_PORT, "");
		}

		public void setPort(String port) {
			editor.putString(WIFI_PORT, port);
			editor.commit();
		}
}
